package pf.springBoot.springBootSSO.controller;
//package pf.springBoot.springBootMetabaseLogin.controller;
//
//import java.util.Collections;
//import java.util.List;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.springframework.boot.autoconfigure.web.ErrorProperties;
//import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController;
//import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
//import org.springframework.boot.web.servlet.error.ErrorAttributes;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.MediaType;
//import org.springframework.http.ResponseEntity;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.util.Assert;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.servlet.ModelAndView;
//
//@Controller
//@RequestMapping("${server.error.path:${error.path:/error}}")
//public class BasicErrorController extends AbstractErrorController {
//	private final ErrorProperties errorProperties;
//	public BasicErrorController(ErrorAttributes errorAttributes,
//			ErrorProperties errorProperties) {
//		this(errorAttributes, errorProperties, Collections.emptyList());
//	}
//	public BasicErrorController(ErrorAttributes errorAttributes,
//			ErrorProperties errorProperties, List<ErrorViewResolver> errorViewResolvers) {
//		super(errorAttributes, errorViewResolvers);
//		Assert.notNull(errorProperties, "ErrorProperties must not be null");
//		this.errorProperties = errorProperties;
//	}
//	@RequestMapping(produces = "text/html")
//	public ModelAndView errorHtml(HttpServletRequest request,
//			HttpServletResponse response) {
//		HttpStatus status = getStatus(request);
////		Map<String, Object> model = Collections.unmodifiableMap(getErrorAttributes(
////				request, isIncludeStackTrace(request, MediaType.TEXT_HTML)));
//		Map<String, Object> model = Collections.unmodifiableMap(getErrorAttributes(
//				request, getTraceParameter(request)));
//		response.setStatus(status.value());
//		ModelAndView modelAndView = resolveErrorView(request, response, status, model);
//		//默认设置返回的是error页面
//		return (modelAndView == null ? new ModelAndView("error", model) : modelAndView);
//	}
//	@RequestMapping
//	@ResponseBody
//	public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
////		Map<String, Object> body = getErrorAttributes(request,
////				isIncludeStackTrace(request, MediaType.ALL));
//		Map<String, Object> body = getErrorAttributes(request,
//				getTraceParameter(request));
//		HttpStatus status = getStatus(request);
//		return new ResponseEntity<>(body, status);
//	}
//	@Override
//	public String getErrorPath() {
//		// TODO Auto-generated method stub
//		return null;
//	}
//	
//	//返回视图
//	@RequestMapping("/index")
//	public String indexHtml(Model model) {
//	    // Duplicated logic
//	    model.addAttribute("test");
//	    //返回视图名字
//	    return "index";         
//	}
//	//返回json
//	@RequestMapping("/errorResTest")
//	@ResponseBody
//	 public String errorResTest(){
//	     int i = 0;
//	     int j = -1;
//	     int x = j/i;
//	     return "erro";
//	 }
//}